
function s_wurenji() {
  aircraftType = 's_wurenji'
  if (downFlag) {
    return
  }
  sWurenjiArray.push(sWurenjiNum)
  var item = 'sWurenji_' + sWurenjiNum
  sWurenjiObj[item] = new Object()
  sWurenjiObj[item].x0 = 0
  sWurenjiObj[item].y0 = 0
  sWurenjiObj[item].ysX = 30 // x轴压缩
  sWurenjiObj[item].ysY = 30 // y轴压缩
  sWurenjiObj[item].textX = sWurenjiObj[item].ysX + 2 // 字体x轴坐标 （宽）
  sWurenjiObj[item].textY = sWurenjiObj[item].ysY / 2 // 字体y轴坐标（高）
  var image = document.getElementById('ar_03')
  var text = sWurenjiNum
  context.strokeText(text, sWurenjiObj[item].textX, sWurenjiObj[item].textY)
  context.drawImage(image, sWurenjiObj[item].x0, sWurenjiObj[item].y0, sWurenjiObj[item].ysX, sWurenjiObj[item].ysY)
  var divRoot = document.getElementById('zbInfo')
  var zb = document.createElement('div')
  zb.innerText = 'S-WRJ[' + sWurenjiNum + ']坐标[' + sWurenjiObj[item].x0 * xv + ',' + sWurenjiObj[item].y0 * yv + ']'
  zb.id = 'fire_' + aircraftType + sWurenjiNum
  divRoot.appendChild(zb)
  sWurenjiNum++
}
function s_wurenji_move(e) {
  if (sWurenjiArray.length > 0) {
    var current = sWurenjiArray.length
    var item = 'sWurenji_' + current
    var obj = sWurenjiObj[item]
    // 清除上一次轨迹 , 清除文字时，注意由字体宽度导致的清除失效
    context.clearRect(sWurenjiObj[item].textX - 2, sWurenjiObj[item].textY - 8, 10, 10)
    context.clearRect(sWurenjiObj[item].x0, sWurenjiObj[item].y0, sWurenjiObj[item].ysX, sWurenjiObj[item].ysY)

    // 保存当前轨迹
    sWurenjiObj[item].x0 = e.clientX
    sWurenjiObj[item].y0 = e.clientY

    // 计算当前汉字位置：
    // 1、飞机坐标+压缩率+字体宽度
    sWurenjiObj[item].textX = e.clientX + sWurenjiObj[item].ysX + 2
    sWurenjiObj[item].textY = e.clientY + sWurenjiObj[item].ysY / 2

    // 当前飞机编号
    var text = sWurenjiArray.length
    //context.font = 'blod 1px 宋体';
    //context.strokeStyle = 'purple';
    context.strokeText(text, sWurenjiObj[item].textX, sWurenjiObj[item].textY)

    var image = document.getElementById('ar_03')
    context.drawImage(image, sWurenjiObj[item].x0, sWurenjiObj[item].y0, sWurenjiObj[item].ysX, sWurenjiObj[item].ysY)
    var zb = document.getElementById('fire_' + aircraftType + sWurenjiArray.length)
    zb.innerHTML = 'S-WRJ[' + sWurenjiArray.length + ']坐标[' + e.clientX * xv + ', ' + e.clientY * yv + ']'
  }
}

function s_wurenji_all() {
  for (let i = 0; i < sWurenjiArray.length; i++) {
    var item = 'sWurenji_' + sWurenjiArray[i]
    var obj = sWurenjiObj[item]
    // 清除上一次轨迹 , 清除文字时，注意由字体宽度导致的清除失效
    context.clearRect(sWurenjiObj[item].textX - 2, sWurenjiObj[item].textY - 8, 10, 10)
    context.clearRect(sWurenjiObj[item].x0, sWurenjiObj[item].y0, sWurenjiObj[item].ysX, sWurenjiObj[item].ysY)
    // 当前飞机编号
    var text = sWurenjiArray[i]
    context.strokeText(text, sWurenjiObj[item].textX, sWurenjiObj[item].textY)
    var image = document.getElementById('ar_03')
    context.drawImage(image, sWurenjiObj[item].x0, sWurenjiObj[item].y0, sWurenjiObj[item].ysX, sWurenjiObj[item].ysY)
  }
}

//  定义的函数
let down=function(data){
  var option = {}
  option.fileName = '飞机经纬度' //文件名
  option.datas = [
    { //第一个sheet（第一个excel表格）
      sheetHeader: ['型号', '编号', '经度', '纬度'],  //表头数据
      sheetFilter: ['planeType', 'planeNum', 'jd', 'wd'],   //表头数据对应的sheetData数据
      //sheetData: [{ planeNum: '一行一列', jd: '一行二列', wd: 'asasa' }],//数据
      sheetData: data,//数据
      sheetName: 'sheet',
      columnWidths: ['8', '4'] // 列宽
    }/* ,
      {
        //第二个sheet（第二个excel）
        sheetData: [{ one: '一行一列', two: '一行二列' }, { one: '二行一列', two: '二行二列' }]
      } */
  ]
  var toExcel = new ExportJsonExcel(option)
  toExcel.saveExcel()
}
// 导出变量，对象，函数
export {
  down
}
